package com.example.mapper;

import com.example.entity.auth.Account;
import com.example.entity.user.UserInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface AccountMapper {
    @Select("select * from user_account where username=#{text} or email=#{text}")
    Account findByNameOrEmail(String text);

    @Select("select * from user_account where username=#{text} or email=#{text}")
    UserInfo findUserInfoByNameOrEmail(String text);

    @Insert("insert into user_account(email,username,password) values (#{email},#{username},#{password})")
    int createAccount(String username,String password,String email);

    @Update("update user_account set password = #{password} where email = #{email}")
    int resetPassword(String password,String email);
}
